import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core';

@Directive({
  selector: '[ktTest]'
})
export class TestDirective {
  private hasView = false;
  @Input() 
  set ktTest(bool:boolean) {
    if (!bool && !this.hasView) {
      this.viewContentRef.createEmbeddedView(this.templateRef, {$limplicit:bool});
      this.hasView = true;
    }else if (bool && this.hasView) {
      this.viewContentRef.clear();
      this.hasView = false;
    }
  }
  constructor(private viewContentRef:ViewContainerRef, private templateRef:TemplateRef<any>) { }

}
